<?php
namespace app\tool\controller;

use app\admin\controller\ApiCommon;
use think\facade\Db;
use think\response\Json;

use app\tool\model\ScarReckonerModel;

class ScarReckoner extends ApiCommon
{
    /**

     * 用于判断权限

     * @permission 无限制

     * @allow 登录用户可访问

     * @author Liu

     * @create 2021-10-01

     */

    public function initialize()

    {



        $action = [

            'permission' => [''],

            'allow' => ['export']

        ];

        event('CheckAuth', $action);

        $request = $this->request;

        $a       = strtolower($request->action());

        if (!in_array($a, $action['permission'])) {

            parent::initialize();

        }

    }


    /**

     * 获取计算器疤痕大类

     * @return Json

     * @author Liu

     * @create 2021-10-01

     */
    public function getIndex(): Json
    {
        $model = new ScarReckonerModel();

        $data = $model->getContent();

        return resultArray(['data' => $data]);
    }

    /**

     * 获取计算器疤痕小类

     * @return Json

     * @author Liu

     * @create 2021-10-01

     */
    public function getSecond(): Json
    {

        $request = request()->param();

        $model = new ScarReckonerModel();

        $data = $model->getSecond($request);

        return resultArray(['data' => $data]);
    }

    /**

     * 计算疤痕费用

     * @return Json

     * @author Liu

     * @create 2021-10-01

     */
    public function scarReckonerSubmit(): Json
    {

        $request = request()->param();

        $model = new ScarReckonerModel();

        $data = $model->scarReckonerSubmit($request);

        return resultArray(['data' => $data]);
    }

}

?>